Work Request Manager API
How to use the WRM API
Overview
The following information describes how to use the Work Request Manager (WRM) API:
- Subscribe for notifications
- Manage a work request end-to-end
- Managing appointments and update schedules
Â
Subscribe for notifications
In order to receive notifications about work requests and activities, consumers (Work Requestor and Work Suppliers) must complete a one-time subscription process.
There are two parts to this process:
- Submit a subscription request -
POST /subscribers
with a secret key and a webhook url that is to be used to receive notifications. - Validate the webhook URL endpoint - Provide a GET endpoint at the webhook url to receive a challenge querystring value that must be echoed in the GET response.
Submit a subscription request
POST /subscribers
The WRM API exposes an endpoint (POST /subscribers
) to enable consumers to subscribe for outbound notifications from the WRM. The subscribing party uses the client authentication credentials supplied by Chorus for Basic Authentication.
In order to submit a subscription request, the Work Requester or Work Supplier provides Chorus with a secret key and a webhook URL where notifications are sent.
WRM generates an HMAC signature of notification payloads and includes that signature in the request headers of the content distribution request. The X-Hub-Signature
header's value is in the form "sha256=". The signature is computed using the HMAC algorithm sha256 with the request body as the data and the secret key as the key.
The secret key is subsequently used to generate the X-Hub-Signature
that is included in all notifications outbound from WRM to the subscriber:
[HTTP Header] X-Hub-Signature: sha256=7d3......a23791c5f6
When the subscriber receives the notification message, they use the secret key to decrypt the X-Hub-Signature
to verify the request source is the WRM API.
Validate the webhook URL endpoint
GET /[webhook]
The consumer exposes a GET
endpoint at the provided webhook URL to receive the challenge. This is an anonymous authentication call, and will uses the encrypted X-Hub-Signature header detailed above.
After the POST /subscribers
operation has been successfully called, the internal WRM publish/subscribe subsystem performs a GET
operation against the provided webhook URL with a one-time, unique challenge string.
The response to the GET
operation must echo the provided challenge string in a json body with an 200 http status code to become verified.
Example
A request is sent from WRM to GET https://consumer_domain/endpoint/?challenge=unique_generated_string&subscriberId=123
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: XXX
Date: Fri, 15 Jan 2021 05:08:21 GMT
Cache-control: private
{
"challenge": "unique_generated_string"
}
Â
Manage a work request end-to-end
The following table describes the end-to-end process for a work request:
Step | Role | Description | Action | Task Status / Substate | Activity Category / State |
---|---|---|---|---|---|
1 | Work Requestor | Create the work request task and send to Work Supplier | Notify with CreateTaskEvent | Allocation/Sent | Open/Open |
2 | Work Supplier | Accept the task | Notify with AcceptTaskEvent | InProgress | Open/Accepted |
3 | Work Supplier | Schedule the activity | Schedule the activity in Work Supplier's internal scheduling system | InProgress | Open/Scheduled |
4 | Work Supplier | Update the activity status | Notify with UpdateTaskActivityStatusEvent | InProgress | Open/[state] |
5 | Work Supplier | Provide details of the allocated field worker | Notify with UpdateTaskActivityWorkerEvent | InProgress | Open/Assigned |
6 | Work Supplier | Confirm arrival of worker at site | Notify with UpdateTaskActivityStatusEvent | InProgress | Active/OnSite |
7 | Work Supplier | Confirm service given | Notify with UpdateTaskActivityStatusEvent | InProgress | Active/PracticalCompletion |
8 | Work Supplier | Provide activity outcomes | Notify with UpdateTaskActivityOutcomesEvent | InProgress | Active/[state] |
9 | Work Supplier | Close the activity | Notify with CloseTaskActivityEvent | InProgress | Closed |
10 | Work Requestor | Close the task on completion of all activities | Automatic close | Closed | Closed |
The following diagram shows the state transition of a work request:
Â
Posting an event notification
POST /notifications
Use this endpoint to notify the Work Requestor of all updates and changes to a task and its associated activitites.
The following table describes the attributes required for all notification types:
Attribute | Details | Type |
---|---|---|
notificationType | The type of notification to be posted, see API Resources > Notifications for a table of available notification types. | enum |
notificationDateTime | The date and time the notification was issued. | datetime |
linked NotificationId | The ID of the original notification that triggered the notification, e.g. the ID of the event notification from the Work Requestor. | string |
notificationId | The notification ID as a GUID. | string |
subscriberId | Your subscriber ID. | string |
task.id | The Id of the task generated by WRM. | string |
Each notification type has different attributes that are required. See details below, or the /notifications
method in the Specification.
Â
Updating a task
This section describes how to use the WRM API to update a task:
Accept or reject a work request
To accept or reject a work request use the AcceptTaskEvent or the RejectTaskEvent notificationTypes.
Rules:
- A work request must be accepted before work can start.
- A work request can only be rejected if work hasn't started.
- When rejecting a Work Request the rejectReason attribute must be supplied.
The following table describes the additional attributes required for the AcceptTaskEvent or RejectTaskEvent event notifications:
Attribute | Details | Type |
---|---|---|
task.allocation.supplierAccepted | The Work Supplier accepts or rejects the task. | boolean |
task.allocation.rejectReason | The reason code associated with the rejection, mandatory for RejectTaskEvents. | enum |
task.allocation.rejectNote | Additional information relating to the rejection, must contain the other task ID for duplicate task rejections. | string (max 5000) |
Provide or receive additional information
To send additional information use the UpdateTaskAdditionalInfosEvent notificationType.
Rule: The interactionType, information, and createdBy fields are mandatory.
The table below describes the additional attributes available for the UpdateTaskAdditionalInfosEvent event notification. Multiple additional information records on a task can be added or updated:
Attribute | Details | Type |
---|---|---|
task.additionalInfos[].interactionId | The Id of the interaction to group information exchanges into threads. | string |
task.additionalInfos[].interactionType | The type of interaction. | string |
task.additionalInfos[].information | Information relating to the request or response. | string (max 5000) |
task.additionalInfos[].createdBy | Name of the entity requesting or responding to the request. | string |
task.additionalInfos[].additionalInfoDetail[].key | Name of additional information detail value. | string |
task.additionalInfos[].additionalInfoDetail[].value | Value of additional information detail value. | string |
task.additionalInfos[].contact | Contact details relating to the additional information, e.g. the site contact. See Types > Contact for details on additional attributes for the Contact object. | Contact |
Â
Attach a file to a task
To attach or update a file use the UpdateTaskFileAttachmentsEvent notificationType.
Rules:
- When updating file attachments on a task, the entire array of file attachments to the task must be provided.
- The update task event must verify that the party requesting the update is the owner of the files.
The table below describes the additional attributes available for the UpdateTaskFileAttachmentsEvent event notification:
Attribute | Details | Type |
---|---|---|
task.fileAttachments[].fileName | The name of the file attached to the task. | string |
task.fileAttachments[].owner | The owner of the file, i.e. the Work Supplier attaching the file. | stirng |
task.fileAttachments[].mediaType | The type of media attached, e.g. pdf, png, json, etc. | enum |
task.fileAttachments[].fileSize | The size of the file attached, in bytes. | number |
task.fileAttachments[].note | A generic note associated with the file attachment. | string (max 5000) |
task.fileAttachments[].fileAttachmentUri | Unique Resource Identifier for the file attachment. | string |
Â
Updating an activity
This section describes how to use the WRM API to update a task:
- Update a worker contact
- Provide a status update
- Attach a file to an activity
- Provide outcomes
- Close an activity
For updating one or more activities on a task, the following additional attributes are required. Not all activities on a task are required to be updated in each event notification:
Attribute | Details | Type |
---|---|---|
task.activities[].id | The Id of the activity being updated. | string |
Â
Update a worker contact
To send Chorus the details of a worker contact use the UpdateTaskActivityWorkerEvent notificationType.
Rule: Provide the worker's name either in the name attribute or both the firstName and lastName attributes.
The following table describes the additional attributes required for the UpdateTaskActivityWorkerEvent event notification. Multiple activities on a task can be updated:
Note: See Types > Contact for details on additional attributes for the Contact object.
Attribute | Details | Type |
---|---|---|
task.activities[].worker.name | Full name of the worker allocated to the activity. Alternatively complete the firstName and lastName attributes. | string |
task.activities[].worker.role | Worker | enum |
Â
Update a schedule
To send Chorus the details of an updated schedule for an activity use the UpdateTaskActivityScheduleByWorkSupplierEvent notificationType.
Rule: Send this notification after:
- confirming schedule details for an activity
- rescheduling an activity
- cancelling an appointment.
See Managing appointments and updating schedules below.
The following table describes the additional attributes required for the UpdateTaskActivityScheduleByWorkSupplierEvent event notification. Multiple activities on a task can be updated:
Attribute | Details | Type |
---|---|---|
task.activities[].schedule.appointmentRequired | If the activity requires an appointment. | boolean |
task.activities[].schedule.appointmentTime | The date and time for the appointment. | datetime |
task.activities[].schedule.nextActionOwner | The owner of the next action when the activity has been rescheduled. | string |
task.activities[].schedule.note | Additional details about the schedule update, e.g. supporting information for reschedule. | string (max 5000) |
task.activities[].schedule.rescheduleReason | The reason for the rescheduling. | enum |
task.activities[].schedule.scheduledStart | The scheduled start time for an activity. | datetime |
task.activities[].schedule.scheduledEnd | The scheduled end time for an activity. | datetime |
task.activities[].schedule.workDivision | The work division allocated to this activity by Chorus, if work type is REMO. | string |
Â
Provide a status update
To send Chorus a status update use the UpdateTaskActivityStatusEvent notificationType. See Manage a work request end-to-end above for the state types.
Rule: The geoTag attribute is mandatory when the category is Active and the state is OnSite.
The following table describes the additional attributes required for the UpdateTaskActivityStatusEvent event notification. Multiple activities on a task can be updated:
Attribute | Details | Type |
---|---|---|
task.activities[].status.category | The overall lifecycle state of the activity, either Open or Active. | enum |
task.activities[].status.state | The state of the activity in relation to its assigned category. | enum |
task.activities[].status.note | Additional information in relation to the activity status. | string (max 5000) |
task.activities[].status.workSupplierDate | The timestamp of the status change from the Work Supplier's internal system. | DateTime |
task.activities[].status.geoTag | The location of the work taking place when category is Active and state is OnSite. | geoTag |
Â
Attach a file to an activity
To attach or update a file use the UpdateTaskActivityFileAttachmentsEvent notificationType.
Rules:
- When updating file attachments on activities, the entire array of file attachments to the activity must be provided.
- The update task event must verify that the party requesting the update is the owner of the files.
The table below describes the additional attributes available for the UpdateTaskActivityFileAttachmentsEvent event notification. Multiple activities on a task can be updated:
Attribute | Details | Type |
---|---|---|
task.activities[].fileAttachments[].fileName | The name of the file attached to the activity. | string |
task.activities[].fileAttachments[].owner | The owner of the file, i.e. Work Supplier attaching the file. | stirng |
task.activities[].fileAttachments[].mediaType | The type of media attached, e.g. pdf, png, json, etc. | enum |
task.activities[].fileAttachments[].fileSize | The size of the file attached, in bytes. | number |
task.activities[].fileAttachments[].note | A generic note associated with the file attachment. | string (max 5000) |
task.activities[].fileAttachments[].fileAttachmentUri | Unique Resource Identifier for the file attachment. | string |
Â
Provide outcomes
To send Outcomes use the UpdateTaskActivityOutcomesEvent notificationType.
The table below describes the additional attributes available for the UpdateTaskActivityOutcomesEvent event notification. Multiple activities on a task can be updated:
Attribute | Details | Type |
---|---|---|
task.activities[].outcomes[].type | The type of outcome. | string |
task.activities[].outcomes[].key | Name of outcome value. | string |
task.activities[].outcomes[].value | The outcome associated with the key. | string |
Â
Close an activity
To close an activity, use the CloseTaskActivityEvent notificationType.
When all activities on a task are closed (including verification activities), the task is automatically closed.
This table below describes the additional attributes avaiable for the CloseTaskActivityEvent event notification. Multiple activities on a task can be updated:
Attribute | Details | Type |
---|---|---|
task.activities[].status.category | Closed | enum |
task.activities[].status.state | Cancelled | Completed | Incomplete | enum |
task.activities[].status.note | Additional information in relation to the activity status. | string (max 5000) |
task.activities[].status.workSupplierDate | The timestamp of the status change from the Work Supplier's internal system. | DateTime |
Â
Managing appointments and updating schedules
This section describes how to manage appointments:
These operations are independent of the main work request management workflow, but the UpdateTaskActivityScheduleByWorkSupplier event notification must be posted to provide updates back to the work requestor.
When the Work Supplier creates a task or adds an activity to a task, the following information is provided in the activity schedule (not all attributes may be present):
Attribute | Details | Type |
---|---|---|
scheduleId | The schedule identifier - provided if an appointment is required and the appointment time is supplied. | string |
siteVisitType | The type of visit or appointment, e.g. Scope, Install, ReplaceONT, etc. | enum |
workDivision | Work division allocated to this activity by the Work Requestor, if the work type is REMO | string |
areaSite | Area site if the work type is REMI, REMS, or PRM. | string |
classOfWork | Class of work if the work type is REMI, REMS, or PRM. | string |
equipmentType | Equipment type if the work type is REMI, REMS, or PRM. | string |
allowAppointmentBroughtForward | Appointment can be brought forward. | boolean |
appointmentBookingId | Appointment booking Id - must be used if Work Supplier reschedules or cancels appointment. | string |
appointmentRequired | Activity requires an appointment. | boolean |
appointmentTime | Date and time for the appointment | datetime |
chorusReschAllowed | Appointment can be rescheduled by the Work Requestor | boolean |
earliestStart | The earliest date and time the activity can be started - must be supplied if latestEnd is not provided. | datetime |
latestEnd | The latest date and time the acitivty must be completed - must be supplied if earliestStart is not provided. | datetime |
The CreateTaskNotify and AddActivityNotify event notifications also provide an externalScheduleReference from the Work Supplier's internal system.
Â
Confirm an appointment
POST /appointments/{bookingId}/confirm
Use this endpoint to confirm an existing reserved appointment.
The table below describes the attributes required to confirm a reserved appointment for all task types:
Attribute | Details | Type |
---|---|---|
bookingId | The activity.schedule.appointmentBookingId from the reserved appointment. | string |
scheduleId | The activity.schedule.Id from the reserved appointment. | string |
areaType | The locale type, either Urban or Rural. | enum |
bookingType | The appointment booking type, either BY or BETWEEN | enum |
workType | Work type as provided by the Work Requestor, either FibreConnect, REMI, REMO, REMS, or PRM. | enum |
location.locationId | The location Id relating to the site. | string |
location.locationIdType | The type of locaiton, either TLC or CONNECTIONPOINT | enum |
The table below describes the additional attributes required to confirm a reserved appointment for a Fulfil task:
Attribute | Details | Type |
---|---|---|
campaignId | The selected campaign. | string |
customerSiteVisitRequired | If a customer site visit is required for this appointment, either YES or NO. | enum |
appointmentType | APPOINTMENT | string |
dayOfWeek | When appointment can be booked, either Business days or Extended hours | enum |
The table below describes the additional attributes required to confirm a reserved appointment for an Assure task:
Attribute | Details | Type |
---|---|---|
productId | The product Id provided by the Work Requestor. | string |
reservationCategory | Priority of appointment date and time, either Preferred or Alternative. | enum |
reservationType | Type of reservation required, either FIRST_AVAILABLE_TIMESLOT or DEFAULT for campaigns. | enum |
requestedStartDateTime | Appointment start date and time provided by the Work Requestor. | datetime |
requestedEndDateTime | Appointment end date and time provided by the Work Requestor. | datetime |
timeslotType | Type of timeslot, either DELIVERY, APPOINTMENT, or APPOINTMENT TIME SLOT. | enum |
After confirming the appointment, post a notification using the UpdateTaskActivityScheduleByWorkSupplierEvent event notification to advise Chorus of the confirmed appointment. See Update a schedule above.
Â
Determine available timeslots
GET /appointments/{bookingId}/timeslots
Use this endpoint to get a list of available timeslots for an appointment for rescheduling.
The following table describes the query parameters required:
Parameter | Details |
---|---|
areaType | The locale type, either Urban or Rural. |
scheduleId | The activity.schedule.Id from the reserved appointment. |
workType | Work type as provided by the Work Requestor, either FibreConnect, REMI, REMO, REMS, or PRM - optional for Fulfil tasks. |
locationId | The location Id relating to the site. |
locationIdType | The type of locaiton, either TLC or CONNECTIONPOINT |
Â
Reschedule an appointment
PUT /appointments/{bookingId}
Use this endpoint to:
- request a change of date and time for an existing confirmed appointment
- reschedule a previously cancelled appointment.
Determine the available timeslots to reschedule the appointment using GET /appointments/{bookingId}/timeslots
, see Determine available timeslots above. Work Requestors are responsible for maintaining their availability through the Service Company Alliance (SCA) system.
Rules:
- Work Suppliers are responsible for supplying the correct booking id and appointment details to the WRM, using the UpdateTaskActivityScheduleByWorkSupplierEvent notification.
- For Assure tasks, either the earliest start or latest end date and times are specified - this determines the schedule type.
Note: If all timeslots for the schedule are used, the PUT /appointments/{bookingId}
operation acts as an override and allows negative units, i.e. the available units becomes -1.
The table below describes the attributes required to reschedule an appointment:
Attribute | Details | Type |
---|---|---|
bookingId | The activity.schedule.appointmentBookingId from the original appointment. | string |
releaseOriginalSlot | The number of units to be added or removed. | number |
requestedEndDateTime | The appointment end date and time. | datetime |
requestedStartDateTime | The appointment start date and time. | datetime |
rescheduleType | The type of schedule - for Fibre Fulfil: APPOINTMENT, Assure: BETWEEN if earliest start is set, BY if latest end is set. | string |
scheduleCode | The externalScheduleReference from the original create task or add activity notification. | string |
After rescheduling the appointment, post a notification using the UpdateTaskActivityScheduleByWorkSupplierEvent event notification to advise Chorus of the updated timeslot. See Update a schedule above.
Â
Cancel an Appointment
DELETE /appointments/{bookingId}
Use this endpoint to cancel an appointment. This removes the appointment but allows it to be rescheduled later.
Rules:
- Work Suppliers are responsible for supplying the correct booking id to the WRM.
- Work Suppliers must retain the original booking ID to use if they want to reschedule a cancelled appointment.
- For Assure tasks, either the earliest start or latest end date and times are specified - this determines the schedule type.
Note: There are no attributes required (except for the bookingId) and no payload is returned.
After cancelling the appointment, post a notification using the UpdateTaskActivityScheduleByWorkSupplierEvent event notification to advise Chorus of the cancelled appointment. See Update a schedule above.